package routes

import (
	"github.com/gin-gonic/gin"
	"higame/middleware"
	"higame/routes/game"
	"higame/routes/goods"
	"higame/routes/integral"
	"higame/routes/log"
	"higame/routes/order"
	"higame/routes/server"
	"higame/routes/trade"
	"higame/routes/upload"
	"higame/routes/user"
)

func Setup() *gin.Engine {
	engine := gin.Default()

	// 静态资源-中间件
	engine.Use(middleware.Static("./assets/static"))

	engine.Use(middleware.Auth())

	user.Bind("/user", engine)

	game.Bind("/game", engine)

	trade.Bind("/trade", engine)

	integral.Bind("/integral", engine)

	goods.Bind("/goods", engine)

	upload.Bind("/upload", engine)

	order.Bind("/order", engine)

	log.Bind("/log", engine)

	server.Bind("/server", engine)

	engine.NoRoute(middleware.HandleError())
	return engine
}
